<?php
/**
 * Created by Zhy
 * User: Zhy
 * Date: 2021/9/24
 * Time: 11:03
 */

namespace app\admin\controller;



use think\Db;
use think\Request;

class Privateorder extends Base
{
    /**
     * 订单列表
     * @return mixed|\think\response\Json
     */
    public function index(){
        if(request()->isAjax ()){
            $keyword = trim(input('keyword'), ' '); // 订单编号
            $user_name = trim(input('user_name'), ' '); // 用户名称
            $po_status = input('po_status');
            $po_type = input('po_type');
            $order_str = 'po_time desc';
        
            $where = [];
            if(isset($keyword) && $keyword != ''){
                $where['po_number'] = ['like', '%' . $keyword . '%'];
            }
            if(isset($user_name) && $user_name != ''){
                $where['user_real_name'] = ['like', '%' . $user_name . '%'];
            }
            if(isset($po_status) && $po_status !=''){
                $where['po_status'] = $po_status;
                if($po_status == 2 || $po_status == 3){
                    $order_str = 'po_check_time desc';
                } elseif($po_status == 4){
                    $order_str = 'po_peihuo_time desc';
                }elseif($po_status == 5){
                    $order_str = 'po_send_time desc';
                }
            }
            if(isset($po_type) && $po_type != ''){
                $where['po_type'] = $po_type;
            }
            $Nowpage = input('page') ? input('page') : 1;
            $limits = input("limit") ? input("limit") : 10;

            $count = Db::table('up_private_order')
                ->join('up_u_user', 'po_user_id = user_id', 'LEFT')
                ->join('up_area u1', 'u1.district_id = po_sheng', 'LEFT')
                ->join('up_area u2', 'u2.district_id = po_shi', 'LEFT')
                ->join('up_area u3', 'u3.district_id = po_qu', 'LEFT')
                ->join('up_private_client', 'pc_id = po_client_id', 'LEFT')
                ->where($where)
                ->count('po_id');
            $lists = Db::table('up_private_order')
                ->join('up_u_user', 'po_user_id = user_id', 'LEFT')
                ->join('up_area u1', 'u1.district_id = po_sheng', 'LEFT')
                ->join('up_area u2', 'u2.district_id = po_shi', 'LEFT')
                ->join('up_area u3', 'u3.district_id = po_qu', 'LEFT')
                ->join('up_private_client', 'pc_id = po_client_id', 'LEFT')
                ->field('po_id, po_number, user_real_name, user_phone, user_shop_name, u1.district sheng, 
                u2.district shi, u3.district qu, po_address, pc_client_name, pc_client_phone, pc_client_age, 
                pc_client_gender, pc_client_marry, po_qrcode, po_time, po_status, po_type, po_check_time, 
                po_peihuo_time, po_send_time, po_refuse_reason')
                ->where($where)
                ->order($order_str)
                ->page($Nowpage,$limits)
                ->select();
            foreach($lists as $k => $v){
                // 收货地址
                $lists[$k]['address'] = $v['sheng'] . $v['shi'] . $v['qu'] . $v['po_address'];
            }

            return json(['code' => 220, 'msg' => '', 'count' => $count, 'data' => $lists]);
        }
        return $this->fetch();
    }
    
    /**
     * 订单详情
     * @return mixed
     */
    public function orderDetail(){
        $po_id = input('po_id');
    
        $order = Db::table('up_private_order')->alias('po')
            ->join('up_private_client pc', 'pc.pc_id = po.po_client_id', 'LEFT')
            ->join('up_private_setmeal ps', 'ps.ps_id = po.po_setmeal_id', 'LEFT')
            ->join('up_u_user uuu', 'uuu.user_id = po.po_user_id', 'LEFT')
            ->join('up_area ua1', 'po.po_sheng = ua1.district_id', 'LEFT')
            ->join('up_area ua2', 'po.po_shi = ua2.district_id', 'LEFT')
            ->join('up_area ua3', 'po.po_qu = ua3.district_id', 'LEFT')
            ->where('po_id', $po_id)
            ->field('po.po_id, po.po_number, po.po_status, po.po_time, pc.pc_client_name, pc.pc_client_phone, 
            pc.pc_client_age, pc.pc_client_gender, pc.pc_client_marry, ps.ps_name, po.po_images, po.po_mj_images, 
            po.po_receive_username, po.po_receive_phone, po.po_address, ua1.district sheng, ua2.district shi, 
            ua3.district qu, po.po_wl_number, po.po_wl_company, po.po_wl_remark, po.po_wl_images, po.po_effect, 
            po.po_remind, uuu.user_real_name, uuu.user_phone, uuu.user_shop_name, po.po_type, po.po_check_time, po.po_peihuo_time, 
            po.po_send_time, po_refuse_reason, po.po_use_explain')
            ->find();
        if($order['po_images']){
            $order['po_images'] = explode(',', $order['po_images']);
        }else{
            $order['po_images'] = [];
        }
        if($order['po_mj_images']){
            $order['po_mj_images'] = explode(',', $order['po_mj_images']);
        }else{
            $order['po_mj_images'] = [];
        }
        if($order['po_wl_images']){
            $order['po_wl_images'] = explode(',', $order['po_wl_images']);
        }else{
            $order['po_wl_images'] = [];
        }
    
        // 皮肤
        $skin = Db::table('up_private_order_skin')
            ->join('up_private_skin', 'pskin_id = pos_ps_id', 'LEFT')
            ->where('pos_po_id', $order['po_id'])
            ->field('pskin_name, pos_psc_id, pos_describe')
            ->select();
        if($skin){
            foreach($skin as $k => $v){
                $psc = Db::table('up_private_skin_config')
                    ->where('psc_id', 'IN', $v['pos_psc_id'])
                    ->column('psc_name');
                $skin[$k]['config_name'] = implode('，', $psc);
            }
        }
        // 配货信息
        $peihuo = Db::table('up_private_order_peihuo')
            ->join('up_private_product', 'pp_id = pop_pp_id', 'LEFT')
            ->where('pop_po_id', $order['po_id'])
            ->field('pp_name, pp_spec, pop_number')
            ->select();
        $peihuo_str = '';
        if($peihuo){
            foreach($peihuo as $kp => $vp){
                $peihuo_str .= $vp['pp_name'] . ' ' . $vp['pp_spec'] . '×' . $vp['pop_number'] . '，';
            }
            $peihuo_str = rtrim($peihuo_str, '，');
        }
        
        $this->assign([
            'order' => $order,
            'skin' => $skin,
            'peihuo' => $peihuo_str
        ]);
        return $this->fetch('privateorder/orderdetail');
    }
    
    /**
     * 编辑订单
     * @return mixed|\think\response\Json
     */
    public function orderEdit(){
        $po_id = input('po_id');
        if(Request::instance()->isPost()){
            $po_client_id = input('po_client_id');
            $po_setmeal_id = input('po_setmeal_id');
            $po_images = input('po_images');
            $po_mj_images = input('po_mj_images');
            $po_receive_username = trim(input('po_receive_username'));
            $po_receive_phone = trim(input('po_receive_phone'));
            $po_sheng = input('po_sheng');
            $po_shi = input('po_shi');
            $po_qu = input('po_qu');
            $po_address = input('po_address');
            $po_wl_number = trim(input('po_wl_number'));
            $po_wl_company = trim(input('po_wl_company'));
            $po_wl_remark = input('po_wl_remark');
            $po_wl_images = input('po_wl_images');
            $product_ids = input('product_ids/a');
            $po_effect = input('po_effect');
            $po_remind = input('po_remind');
            $po_use_explain = input('po_use_explain');
            
            Db::startTrans();
            try{
                // 更新订单表
                $update = [
                    'po_id' => $po_id,
                    'po_client_id' => $po_client_id,
                    'po_setmeal_id' => $po_setmeal_id,
                    'po_images' => $po_images,
                    'po_mj_images' => $po_mj_images,
                    'po_receive_username' => $po_receive_username,
                    'po_receive_phone' => $po_receive_phone,
                    'po_sheng' => $po_sheng,
                    'po_shi' => $po_shi,
                    'po_qu' => $po_qu,
                    'po_address' => $po_address,
                    'po_effect' => $po_effect,
                    'po_remind' => $po_remind,
                    'po_use_explain' => $po_use_explain,
                    'po_wl_number' => $po_wl_number,
                    'po_wl_company' => $po_wl_company,
                    'po_wl_remark' => $po_wl_remark,
                    'po_wl_images' => $po_wl_images,
                    'po_update_time' => date('Y-m-d H:i:s')
                ];
                Db::table('up_private_order')->update($update);
                
                // 更新配货表
                if(isset($product_ids) && $product_ids != ''){
                    Db::table('up_private_order_peihuo')->where('pop_po_id', $po_id)->delete();
                    $insert_all = [];
                    foreach($product_ids as $k => $v){
                        $insert_all[$k] = [
                            'pop_po_id' => $po_id,
                            'pop_pp_id' => $v
                        ];
                    }
                    Db::table('up_private_order_peihuo')->insertAll($insert_all);
                }
                
                Db::commit();
                return json(['code' => 200, 'msg' => '编辑成功']);
            }catch(\Exception $e){
                Db::rollback();
                return json(['code' => 100, 'msg' => $e->getMessage()]);
            }
        }
        // 订单
        $order = Db::table('up_private_order')
            ->where('po_id', $po_id)
            ->field('po_id, po_images, po_receive_username, po_receive_phone, po_address, po_sheng, po_shi, 
            po_qu, po_remind, po_effect, po_user_id, po_client_id, po_setmeal_id, po_wl_number, po_wl_company, 
            po_wl_remark, po_wl_images, po_use_explain, po_mj_images')
            ->find();
        
        // 订单产品
        $order_products = Db::table('up_private_order_peihuo')
            ->where('pop_po_id', $po_id)
            ->column('pop_pp_id');
        
        // 套餐
        $setmeal = Db::table('up_private_setmeal')->where('ps_status', 1)->field('ps_id, ps_name')->select();
        // 客户
        $client = Db::table('up_private_client')
            ->where(['pc_user_id' => $order['po_user_id'], 'pc_client_status' => 1])
            ->field('pc_id, pc_client_name, pc_client_phone')
            ->select();
        // 产品
        $products = Db::table('up_private_product')->where('pp_status', 1)->field('pp_id, pp_name')->select();
        // 省
        $province = Db::table('up_area')->where('level', 1)->field('district_id, district')->select();
        // 市
        $city = Db::table('up_area')->where('pid', $order['po_sheng'])->field('district_id, district')->select();
        // 区
        $district = Db::table('up_area')->where('pid', $order['po_shi'])->field('district_id, district')->select();
        $this->assign([
            'po_id' => $po_id,
            'order' => $order,
            'setmeal' => $setmeal,
            'client' => $client,
            'province' => $province,
            'city' => $city,
            'district' => $district,
            'order_product' => $order_products,
            'product' => $products
        ]);
        return $this->fetch('privateorder/orderedit');
    }
    
    /**
     * 皮肤
     * @return mixed|\think\response\Json
     */
    public function orderSkin(){
        if(request()->isAjax ()){
            $where['pos_po_id'] = session('po_id');
            $Nowpage = input('page') ? input('page') : 1;
            $limits = input("limit") ? input("limit") : 10;
        
            $count = Db::table('up_private_order_skin')
                ->join('up_private_skin', 'pskin_id = pos_ps_id', 'LEFT')
                ->where($where)
                ->count();
            $lists = Db::table('up_private_order_skin')
                ->join('up_private_skin', 'pskin_id = pos_ps_id', 'LEFT')
                ->field('pos_id, pos_ps_id, pos_psc_id, pos_describe, pskin_name')
                ->where($where)
                ->order('pos_id desc')
                ->page($Nowpage,$limits)
                ->select();
            foreach($lists as $k => $v){
                // 配置
                $config = Db::table('up_private_skin_config')->where('psc_id', 'IN', $v['pos_psc_id'])->column('psc_name');
                $lists[$k]['config'] = implode('，', $config);
            }
            return json(['code' => 220, 'msg' => '', 'count' => $count, 'data' => $lists]);
        }
        $po_id = input('po_id');
        if(isset($po_id) && $po_id != ''){
            session('po_id', $po_id);
        }
        return $this->fetch('privateorder/orderskin');
    }
    
    /**
     * 添加皮肤
     * @return mixed|\think\response\Json
     */
    public function skinAdd(){
        if(Request::instance()->isPost()){
            $pos_ps_id = input('pos_ps_id');
            $pos_psc_id = input('select');
            $pos_describe = input('pos_describe');
            
            $choose_skin = Db::table('up_private_order_skin')->where('pos_po_id', session('po_id'))->column('pos_ps_id');
            if(in_array($pos_ps_id, $choose_skin)) return json(['code' => 100, 'msg' => '该皮肤已选择']);
            $insert = [
                'pos_po_id' => session('po_id'),
                'pos_ps_id' => $pos_ps_id,
                'pos_psc_id' => $pos_psc_id,
                'pos_describe' => $pos_describe
            ];
            $res = Db::table('up_private_order_skin')->insert($insert);
            if($res){
                return json(['code' => 200, 'msg' => '添加成功']);
            }else{
                return json(['code' => 100, 'msg' => '添加失败']);
            }
        }
        $skin = Db::table('up_private_skin')->where('pskin_status', 1)
            ->field('pskin_id, pskin_name')->select();
        return $this->fetch('privateorder/skinadd', ['skin' => $skin]);
    }
    
    /**
     * 编辑皮肤
     * @return mixed|\think\response\Json
     */
    public function skinEdit(){
        $pos_id = input('pos_id');
        if(Request::instance()->isPost()){
            $pos_ps_id = input('pos_ps_id');
            $select = input('select');
            $pos_describe = input('pos_describe');
            if(!$select) return json(['code' => 100, 'msg' => '请选择合适的皮肤配置选项']);
    
            $choose_skin = Db::table('up_private_order_skin')
                ->where('pos_po_id', session('po_id'))
                ->where('pos_ps_id', $pos_ps_id)
                ->where('pos_id', 'NEQ', $pos_id)
                ->find();
            if($choose_skin) return json(['code' => 100, 'msg' => '该皮肤已选择']);
            
            $update = [
                'pos_id' => $pos_id,
                'pos_ps_id' => $pos_ps_id,
                'pos_psc_id' => $select,
                'pos_describe' => $pos_describe,
                'pos_update_time' => date('Y-m-d H:i:s')
            ];
            $res = Db::table('up_private_order_skin')->update($update);
            if($res){
                return json(['code' => 200, 'msg' => '编辑成功']);
            }else{
                return json(['code' => 100, 'msg' => '编辑失败']);
            }
        }
        
        $skin = Db::table('up_private_skin')->where('pskin_status', 1)
            ->field('pskin_id, pskin_name')->select();
        $config = Db::table('up_private_order_skin')
            ->where('pos_id', $pos_id)
            ->field('pos_ps_id, pos_psc_id, pos_describe')
            ->find();
        $this->assign([
            'pos_id' => $pos_id,
            'skin' => $skin,
            'config' => $config,
        ]);
        return $this->fetch('privateorder/skinedit');
    }
    
    /**
     * 根据皮肤查询配置选项
     * @return \think\response\Json
     */
    public function showConfig(){
        $pos_ps_id = input('pos_ps_id');
        $pos_psc_id = input('pos_psc_id');
        $data = Db::table('up_private_skin_config')
            ->where('psc_pskin_id', $pos_ps_id)
            ->where('psc_status', 1)
            ->field('psc_id as value, psc_name as name')
            ->select();
        $data1 = [];
        if(isset($pos_psc_id) && $pos_psc_id != ''){
            $data1 = Db::table('up_private_skin_config')
                ->where('psc_id', 'IN', $pos_psc_id)
                ->field('psc_id as value, psc_name as name')
                ->select();
        }
        if($data){
            return json(['code' => 200, 'msg' => $data, 'data1' => $data1]);
        }else{
            return json(['code' => 100, 'msg' => '暂无配置选项']);
        }
    }
    
    /**
     * 删除皮肤
     * @return \think\response\Json
     */
    public function skinDel(){
        $pos_id = input('id');
        $res = Db::table('up_private_order_skin')->delete($pos_id);
        if($res){
            return json(['code' => 200, 'msg' => '删除成功']);
        }else{
            return json(['code' => 100, 'msg' => '删除成功']);
        }
    }
    
    /**
     * 删除订单
     * @return \think\response\Json
     */
    public function orderDel(){
        $po_id = input('id');
        
        Db::startTrans();
        try{
            //删除订单
            Db::table('up_private_order')->delete($po_id);
            
            // 删除皮肤
            Db::table('up_private_order_skin')->where('pos_po_id', $po_id)->delete();
            
            // 删除配货
            Db::table('up_private_order_peihuo')->where('pop_po_id', $po_id)->delete();
            
            Db::commit();
            return json(['code' => 200, 'msg' => '删除成功']);
        }catch(\Exception $e){
            Db::rollback();
            return json(['code' => 100, 'msg' => $e->getMessage()]);
        }
    }
    
    /**
     * 下载二维码
     */
    public function orderQrcodeDown(){
        $po_id = input('id');
        $order = Db::table('up_private_order')
            ->join('up_private_client', 'pc_id = po_client_id', 'LEFT')
            ->where('po_id', $po_id)
            ->field('po_qrcode, po_number, pc_client_name, po_client_id')
            ->find();
        $url = $order['po_qrcode'];
        $type = strtolower(substr(strrchr($url, '.'), 1)); // 截取文件后缀
        $filename = $order['pc_client_name'] . '_' . $order['po_client_id'] . '.' . $type;
        $mime = 'application/force-download';
        header('Pragma: public'); // required
        header('Expires: 0'); // no cache
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Cache-Control: private',false);
        header('Content-Type: '.$mime);
        header('Content-Disposition: attachment; filename="'.$filename.'"');
        header('Content-Transfer-Encoding: binary');
        header('Connection: close');
        readfile($url); // push it out
        exit();
    }
    
    /**
     * 导出订单
     * @return \think\response\Json
     */
    public function outExcel(){
        set_time_limit(0);
        $po_ids = input('ids');

        $where = [];
        $order_str = 'po_time desc';
        if($po_ids == -1){
            $keyword = trim(input('keyword'), ' '); // 订单编号
            $user_name = trim(input('user_name'), ' '); // 用户名称
            $po_status = input('po_status');
            $po_type = input('po_type');

            if(isset($keyword) && $keyword != ''){
                $where['po_number'] = ['like', '%' . $keyword . '%'];
            }
            if(isset($user_name) && $user_name != ''){
                $where['user_real_name'] = ['like', '%' . $user_name . '%'];
            }
            if(isset($po_status) && $po_status !=''){
                $where['po_status'] = $po_status;
                if($po_status == 2 || $po_status == 3){
                    $order_str = 'po_check_time desc';
                } elseif($po_status == 4){
                    $order_str = 'po_peihuo_time desc';
                }elseif($po_status == 5){
                    $order_str = 'po_send_time desc';
                }
            }
            if(isset($po_type) && $po_type != ''){
                $where['po_type'] = $po_type;
            }
        }else{
            if($po_ids == ''){
                return json(['code' => 100, 'msg' => '请选择需要导出的数据']);
            }
            $where['po_id'] = ['IN', $po_ids];
        }

        $order = Db::table('up_private_order')
            ->join('up_private_client', 'po_client_id = pc_id', 'LEFT')
            ->join('up_u_user', 'user_id = pc_user_id', 'LEFT')
            ->join('up_private_setmeal', 'po_setmeal_id = ps_id', 'LEFT')
            ->join('up_area ua1', 'ua1.district_id = po_sheng', 'LEFT')
            ->join('up_area ua2', 'ua2.district_id = po_shi', 'LEFT')
            ->join('up_area ua3', 'ua3.district_id = po_qu', 'LEFT')
            ->where($where)
            ->field('po_number, pc_client_name, pc_client_phone, pc_client_age, pc_client_gender, 
            pc_client_marry, user_username, user_phone, user_shop_name, ps_name, po_status, po_type, 
            po_receive_username, po_receive_phone, ua1.district sheng, ua2.district shi, ua3.district qu, 
            po_address, po_wl_number, po_wl_company, po_wl_remark, po_time, po_check_time, po_peihuo_time, 
            po_send_time, po_id, po_refuse_reason, user_real_name')
            ->order($order_str)
            ->select();
        foreach($order as $k => $v){
            // 订单编号
            $order[$k]['po_number'] = "\t" . $v['po_number'] . "\t";
            // 客户手机号
            $order[$k]['pc_client_phone'] = "\t" . $v['pc_client_phone'] . "\t";
            // 客户性别
            $order[$k]['pc_client_gender'] = $v['pc_client_gender'] == 1 ? '男' : '女';
            // 客户婚姻状况
            $order[$k]['pc_client_marry'] = $v['pc_client_marry'] == 1 ? '未婚' : '已婚';
            // 用户手机号
            $order[$k]['user_phone'] = "\t" . $v['user_phone'] . "\t";
            // 订单状态
            if($v['po_status'] == 1){
                $status = '待审核';
            }elseif($v['po_status'] == 2){
                $status = '审核通过';
            }elseif($v['po_status'] == 3){
                $status = '审核驳回';
            }elseif($v['po_status'] == 4){
                $status = '已配货';
            }elseif($v['po_status'] == 5){
                $status = '已发货';
            }else{
                $status = '已收货';
            }
            $order[$k]['po_status'] = $status;
            // 订单类型
            $order[$k]['po_type'] = $v['po_type'] == 1 ? '会员订单' : '非会员订单';
            // 收货手机号
            $order[$k]['po_receive_phone'] = "\t" . $v['po_receive_phone'] . "\t";
            // 收货地址
            $order[$k]['po_address'] = $v['sheng'] . $v['shi'] . $v['qu'] . $v['po_address'];
            // 物流订单编号
            $order[$k]['po_wl_number'] = "\t" . $v['po_wl_number'] . "\t";
            // 皮肤
            $skin = Db::table('up_private_order_skin')
                ->join('up_private_skin', 'pskin_id = pos_ps_id', 'LEFT')
                ->where('pos_po_id', $v['po_id'])
                ->field('pskin_name, pos_psc_id, pos_describe')
                ->select();
            $skin_str = '';
            foreach($skin as $ks => $vs){
                $config = Db::table('up_private_skin_config')->where('psc_id', 'IN', $vs['pos_psc_id'])->column('psc_name');
                $config_str = implode('，', $config);
                $skin_str .= '皮肤：' . $vs['pskin_name'] . '，配置选项：' . $config_str . '，备注：' . $vs['pos_describe'] . "\n";
            }
            $order[$k]['skin'] = rtrim($skin_str, "\n");
            // 配货信息
            $peihuo = Db::table('up_private_order_peihuo')
                ->join('up_private_product', 'pp_id = pop_pp_id', 'LEFT')
                ->where('pop_po_id', $v['po_id'])
                ->field('pp_name, pp_spec, pop_number')
                ->select();
            $peihuo_str = '';
            if($peihuo){
                foreach($peihuo as $kp => $vp){
                    $peihuo_str .= $vp['pp_name'] . ' ' . $vp['pp_spec'] . '×' . $vp['pop_number'] . '，';
                }
                $peihuo_str = rtrim($peihuo_str, '，');
            }
            $order[$k]['peihuo'] = $peihuo_str;
        }
        $cellname = [
            ['po_id', '订单ID', 10, 'LEFT'],
            ['po_number', '订单编号', 20, 'LEFT'],
            ['ps_name', '所属套餐', 20, 'LEFT'],
            ['po_status', '订单状态', 15, 'LEFT'],
            ['po_refuse_reason', '拒绝原因', 15, 'LEFT'],
            ['po_type', '订单类型', 15, 'LEFT'],
            ['user_real_name', '用户名称', 15, 'LEFT'],
            ['user_phone', '用户手机号', 15, 'LEFT'],
            ['user_shop_name', '店铺名称', 15, 'LEFT'],
            ['pc_client_name', '客户名称', 15, 'LEFT'],
            ['pc_client_phone', '客户手机号', 15, 'LEFT'],
            ['pc_client_age', '客户年龄', 15, 'LEFT'],
            ['pc_client_gender', '客户性别', 15, 'LEFT'],
            ['pc_client_marry', '客户婚姻状况', 15, 'LEFT'],
            ['po_receive_username', '收货人', 15, 'LEFT'],
            ['po_receive_phone', '收货人手机号', 15, 'LEFT'],
            ['po_address', '收获地址', 30, 'LEFT'],
            ['po_wl_company', '物流公司', 15, 'LEFT'],
            ['po_wl_number', '物流单号', 20, 'LEFT'],
            ['po_wl_remark', '物流备注', 20, 'LEFT'],
            ['skin', '皮肤信息', 60, 'LEFT'],
            ['peihuo', '配货信息', 30, 'LEFT'],
            ['po_time', '下单时间', 20, 'LEFT'],
            ['po_check_time', '审核时间', 20, 'LEFT'],
            ['po_peihuo_time', '配货时间', 20, 'LEFT'],
            ['po_send_time', '发货时间', 20, 'LEFT'],
        ];
        $res = exportExcelZhy('私人订制订制订单', 'privateOrder', $cellname, $order);
        return json($res);
    }
}
